<?php

namespace App\Http\Controllers\Api;

use App\Customize\Dysms\SendSms;
use App\Http\Controllers\Controller;
use App\Http\Requests\Api\CodeRequest;
use App\Services\CodeService;

class SendCodeController extends Controller
{
    public function postCode(CodeRequest $request){
        $data = $request->all();
        // 一分钟内发送过吗
        CodeService::havCode($data['phone']);
        // 获取验证码
        $code = CodeService::getCode($data['phone']);
        // $tpl = "";
        // $send_result = SendSms::sendSms($data['phone'],$code,$tpl);
        return $this->resJson(200,'success',$code);
    }
}
